import routes from './router/index'
import {useRoutes} from 'react-router-dom'
import React,{Suspense} from 'react'
const App = () => {
  // 根据路由表生成路由规则
  const element = useRoutes( routes )
  return (
    <div>
      {/* Suspense组件需要fallback传入一个组件或者HTML标签来进行懒加载效果的应急 */ }
      <Suspense fallback={ <div>loading...</div> }>
        {/* 展示区 */ }
        { element }
        {
          //下面这种方式也是可以的
          // <RouterProvider router={routes}></RouterProvider> 
        }
      </Suspense>
    </div>
  )
}

export default App